home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 2
/
AACD 2.iso
/
AACD
/
Magazine
/
Rebol
/
bbc_txt_2.r
< prev
next >
Wrap
Text File
|
1999-09-30
|
1KB
|
37 lines
REBOL [
Title: "BBC News -- Headline Extractor #2"
Date: 28-September-1999
File: %bbc_txt_2.r
Purpose: {
Download the BBC News page and form a digest file
of the headlines.
Also strips tags from text (such as the <B>..</B>).
}
]
; Allow REBOL to write to the file without constant prompting
; (Run REBOL with -s option to avoid the prompt from this command, too)
secure none
; A function to do the tag stripping
; (The code is like one of the trivial examples)
strip-tags: func [str /local lst txt]
[txt: make string! 10
lst: parse/all trim/lines str "<>"
forskip lst 2 [append txt first lst]
txt]
out: %digest.txt
write out ""
text: read http://news.bbc.co.uk/
line: ["<TD" thru ">" any [newline | "<FONT" thru ">" | <B>]
["<A" thru {">} any newline
[ "<IMG" | "<PARAM"
| copy item to "</A>" (write/append out rejoin [strip-tags item "^/"])]
| none]
thru </TD>]
parse text
[thru <!--******** "Todays date" component ******** -->
some [line | newline | thru <TR> | thru </HTML>]
]